<template>
  <div
    class="left_sidebar_item"
    @click="goIndex"
    :class="{ left_sidebar_item__active: leftTagPath === '/wel' }"
  >
    <sidebarIcon icon="HomeFilled" />
    <div class="item_text">首页</div>
  </div>
  <div
    class="left_sidebar_item"
    v-for="item in menu"
    @click="openModel(item)"
    :class="{ left_sidebar_item__active: leftTagPath === item.path }"
  >
    <sidebarIcon :icon="item.icon" />
    <el-tooltip placement="right" :content="item.name" effect="dark">
      <div class="item_text">{{ item.name }}</div>
    </el-tooltip>
  </div>
</template>

<script>
import sidebarIcon from "./sidebar-icon.vue";

export default {
  components: { sidebarIcon },
  data() {
    return {};
  },
  props: ["menu", "leftTagPath"],
  emits: ["openModel"],
  methods: {
    openModel(item) {
      if (item.children) {
        this.$emit("openModel", item);
      } else if (item.type===2) {
        window.open(item.path);
      }else {
        this.$router.push(item.path);
      }
    },
    goIndex() {
      this.$router.push("/");
    },
  },
};
</script>
